//
//  HZ_TableViewCell.m
//  HZ_Beautiful_Music
//
//  Created by dllo on 16/3/30.
//  Copyright © 2016年 ui. All rights reserved.
//

#import "HZ_TableViewCell.h"

@implementation HZ_TableViewCell

- (void)dealloc {
    
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.backgroundColor = [UIColor clearColor];
        
        NSString *state = [[NSUserDefaults standardUserDefaults] objectForKey:@"night"];
        if ([state isEqualToString:@"yes"]) {
            self.backgroundColor = [UIColor colorWithRed:49 / 255.0 green:47 / 255.0 blue:53 / 255.0 alpha:1];
        }else {
            self.backgroundColor = [UIColor clearColor];
        }
    }
    NSNotificationCenter *centerTWO = [NSNotificationCenter defaultCenter];
    
    [centerTWO addObserver:self selector:@selector(buttonNotification:) name:@"heibai" object:nil];
    
    return  self;
    
}

- (void)buttonNotification:(NSNotification *)notification{
    UIColor *color = [notification object];
    self.backgroundColor = color;
    if (color == [UIColor clearColor]) {
        self.backgroundColor = [UIColor colorWithRed:49 / 255.0 green:47 / 255.0 blue:53 / 255.0 alpha:1];
    }else {
        self.backgroundColor = [UIColor grayColor];
    }
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
